#include "pch.h"

StateMainGame::StateMainGame()
{

}

StateMainGame::~StateMainGame()
{

}

// enter state
void StateMainGame::OnEnter()
{
	Box2DManager::Create();
	RobotManager::Create();
	ActionManager::Create();
	GameScene::Create();


	GameScene::Instance()->Initialize();

	Box2DManager::Instance()->SetContactListener(GameScene::Instance()->GetContactListener());
}

// leave state
void StateMainGame::OnLeave()
{
	GameScene::Destory();
	ActionManager::Destory();
	RobotManager::Destory();
	Box2DManager::Destory();
}

// update
void StateMainGame::OnUpdate(float frameTime)
{
	RobotManager::Instance()->OnUpdate(frameTime);
	ActionManager::Instance()->OnUpdate(frameTime);
	Box2DManager::Instance()->OnUpdate(frameTime);
	GameScene::Instance()->OnUpdate(frameTime);
}

// render
void StateMainGame::OnPreRender()
{
	RobotManager::Instance()->OnPreRender();
	GameScene::Instance()->OnPreRender();
	Box2DManager::Instance()->OnPreRender();
}

